#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <UIKit/UITransitionView.h>
#import <UIKit/UIPreferencesTable.h>
#import <UIKit/UISegmentedControl.h>
#import <UIKit/UISwitchControl.h>
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CoreSurface/CoreSurface.h>
#import <LayerKit/LKLayer.h>
#include <pthread.h>
#import <GraphicsServices/GraphicsServices.h>
#include "draw.h"

CoreSurfaceBufferRef screenSurface;
pthread_cond_t screenUpdateLock;
pthread_mutex_t screenUpdateMutex;
PIXEL *m_cba;

@interface MainView : UIView 
{
 	id  mParent;
    LKLayer *screenLayer;
	int initGraphics;
	int initImage;
	CGImageRef sourceImage;
	bool cleanSourceImage;
    pthread_t emulation_tid;
}
- (void)view:(UIView *)view handleTapWithCount:(int)count event:(GSEvent *)event ;
- (void)dealloc;
- (id)initWithFrame:(CGRect)frame andParent:(id)parent;
- (void)drawRect:(CGRect)frame;
- (void)updateScreen;
- (void)doinitImage:(CGImageRef)image andClean:(bool)clean;
- (void)startEmulator;
- (void)stopEmulator;
- (BOOL)ignoresMouseEvents;
- (void)mouseDown:(struct __GSEvent *)event;
- (void)mouseDragged:(struct __GSEvent *)event;
- (void)mouseUp:(struct __GSEvent *)event;
@end
